from flask import Flask
from flask_apscheduler import APScheduler

scheduler = APScheduler()


def init_scheduler(app: Flask):
    scheduler.init_app(app)
    with app.app_context():
        # 导入内置定时任务函数
        # from task_app.tasks import tasks
        scheduler.start()
        # 添加监听
        from task_app.tasks import events
